package com.example.jsondemo.api;

import com.example.jsondemo.dto.RuleDefinition;
import com.example.jsondemo.service.RuleDefinitionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Keson
 * @version 1.0  权限控制API
 * @description: TODO
 * @date 2021/9/15 11:34
 */
@RestController
@RequestMapping("/v1")
public class RuleDefinitionApi {

    @Autowired
    private RuleDefinitionService RuleDefinitionService;

    @GetMapping("/getRules")
    @ApiOperation(value = "得到用户角色关联规则")
    List<RuleDefinition> getRules(@RequestParam("resourceContext")String resourceContext,
                                  @RequestParam("roleId")String roleId,
                                  @RequestParam("roleIds")List<String> roleIds){
        return RuleDefinitionService.getRules(resourceContext, roleId, resourceContext , roleIds);
    }
}
